﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.MarketUI {
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import Display.*;
    import Classes.doobers.*;
    import flash.text.*;
    import Classes.inventory.*;
    import Display.aswingui.*;
    import L10n.*;
    import Display.MarketUI.assets.*;

    public class ItemCatalogToolTip extends JPanel {

        protected var m_dataItem:Item;
        protected var m_coinAP:AssetPane;
        protected var m_personAP:AssetPane;
        protected var m_xpAP:AssetPane;
        protected var m_foodAP:AssetPane;
        protected var m_goodsAP:AssetPane;
        protected var m_contentPanel:JPanel;
        protected var m_titleText:AssetPane;
        protected var m_hr:AssetPane;
        protected var m_titleTextField:TextField;
        protected var m_ttbg:DisplayObject;
        protected var m_centerHrPanel:JPanel;
        private var originalTTWidth:Number;

        public function ItemCatalogToolTip(){
            super(ASwingHelper.softBoxLayoutVertical);
            var _local1:TextFormat = new TextFormat();
            _local1.align = TextFormatAlign.CENTER;
            this.m_contentPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP);
            this.m_ttbg = (new EmbeddedArt.mkt_pop_info() as DisplayObject);
            this.setBackgroundDecorator(new AssetBackground(this.m_ttbg));
            var _local2:DisplayObject = (new EmbeddedArt.mkt_rollover_horizontalRule() as DisplayObject);
            _local2.width = (this.m_ttbg.width - 10);
            this.m_hr = new AssetPane(_local2);
            this.m_titleText = ASwingHelper.makeMultilineCapsText("", (this.m_ttbg.width - 10), EmbeddedArt.TITLE_FONT, TextFormatAlign.CENTER, 16, EmbeddedArt.brownTextColor);
            this.m_titleTextField = (this.m_titleText.getAsset() as TextField);
            this.setPreferredWidth(this.m_ttbg.width);
            this.originalTTWidth = this.m_ttbg.width;
            this.m_centerHrPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
            this.m_hr.setPreferredWidth(this.m_ttbg.width);
            this.m_centerHrPanel.appendAll(ASwingHelper.horizontalStrut(5), this.m_hr);
            var _local3:JPanel = this.GetSalePanelForItem();
            this.appendAll(this.m_titleText, this.m_centerHrPanel, this.m_contentPanel, ASwingHelper.verticalStrut(25), _local3);
            ASwingHelper.prepare(this.parent);
        }
        private function GetSalePanelForItem():JPanel{
            if (this.m_dataItem == null){
                return (null);
            };
            if (this.m_dataItem.sale == 0){
                return (null);
            };
            var _local1:Object = new Object();
            _local1.type = TooltipType.SALE;
            _local1.title = ZLoc.t("Dialogs", "TT_Sale");
            var _local2:int = this.m_dataItem.GetItemCost();
            _local1.firstData = _local2;
            _local1.lastLine = this.m_dataItem.GetItemSalePrice();
            _local1.firstIcon = (new EmbeddedArt.mkt_saleIcon() as DisplayObject);
            _local1.secondIcon = (new EmbeddedArt.mkt_strikethroughIcon() as DisplayObject);
            var _local3:JPanel = TooltipFactory.getInstance().createTooltip(_local1);
            return (_local3);
        }
        public function changeInfo(_arg1:Item=null, _arg2:Object=null):void{
            var _local3:String;
            var _local4:String;
            var _local5:String;
            var _local6:String;
            var _local7:Item;
            var _local8:String;
            var _local9:int;
            var _local10:int;
            this.m_dataItem = _arg1;
            this.m_contentPanel.removeAll();
            if (this.m_dataItem != null){
                this.prepareFilteredTitle();
            };
            if (this.m_dataItem != null){
                this.handleTooltips();
            } else {
                if (_arg2 != null){
                    if (this.containsChild(this.m_centerHrPanel)){
                        this.remove(this.m_centerHrPanel);
                    };
                    switch (_arg2["type"]){
                        case TooltipType.DESCRIPTION:
                            _local3 = _arg2["title"];
                            _local4 = _arg2["description"];
                            _local5 = _arg2["requirement"];
                            this.m_contentPanel = TooltipFactory.getInstance().createDescriptionTooltip(this.m_contentPanel, _local3, _local4, _local5);
                            break;
                        case TooltipType.BUSINESS:
                            _local6 = _arg2["title"];
                            _local7 = _arg2["item"];
                            _local8 = _arg2["crewName"];
                            _local9 = _arg2["upgradeLevel"];
                            _local10 = _arg2["upgradeProgress"];
                            this.m_contentPanel = TooltipFactory.getInstance().createBusinessTooltip(this.m_contentPanel, _local6, _local7, _local8, _local9, _local10);
                            break;
                    };
                };
            };
            ASwingHelper.prepare(this.parent);
        }
        private function prepareFilteredTitle():void{
            var _local1:String = this.m_dataItem.localizedName;
            if ((((this.m_dataItem.type == "business")) && (Global.franchiseManager.model.getOwnsFranchise(this.m_dataItem.name)))){
                _local1 = Global.franchiseManager.getFranchiseName(this.m_dataItem.name, Global.player.uid);
            };
            var _local2 = 16;
            this.m_titleText = ASwingHelper.makeMultilineCapsText(_local1, (this.m_ttbg.width - 55), EmbeddedArt.TITLE_FONT, TextFormatAlign.CENTER, _local2, EmbeddedArt.orangeTextColor);
            var _local3:uint = (this.m_titleText.getAsset() as TextField).numLines;
            LocaleHelper.localSetting.TextField_adjust((this.m_titleText.getAsset() as TextField), {
                embedFonts:false,
                font:EmbeddedArt.SYSTEM_FONT,
                size:_local2
            });
            LocaleHelper.localSetting.ASwingHelper_setPreferredHeight(this.m_titleText, ((_local3 * 22) + 2));
            var _local4:JPanel = ASwingHelper.centerElement(this.m_titleText);
            this.m_contentPanel.appendAll(_local4);
        }
        private function handleTooltips():void{
            var _local3:Object;
            var _local4:JPanel;
            var _local5:Object;
            var _local6:JPanel;
            var _local7:Object;
            var _local8:Object;
            var _local9:JPanel;
            var _local10:Object;
            var _local11:JPanel;
            var _local12:Object;
            var _local13:JPanel;
            var _local14:Object;
            var _local15:JPanel;
            var _local16:Object;
            var _local17:JPanel;
            var _local18:JPanel;
            var _local19:Object;
            var _local20:JPanel;
            var _local21:Object;
            var _local22:JPanel;
            var _local23:Object;
            var _local24:JPanel;
            var _local25:Object;
            var _local26:JPanel;
            var _local27:Object;
            var _local28:JPanel;
            var _local29:JPanel;
            var _local30:Object;
            var _local31:JPanel;
            var _local32:Object;
            var _local33:JPanel;
            var _local34:Object;
            var _local35:int;
            var _local36:int;
            var _local37:int;
            var _local38:int;
            var _local39:Object;
            var _local40:Object;
            var _local41:JPanel;
            var _local42:Boolean;
            var _local43:Object;
            var _local44:JPanel;
            var _local45:Object;
            var _local46:JPanel;
            var _local47:Object;
            var _local48:DisplayObject;
            var _local49:DisplayObject;
            var _local50:int;
            var _local51:Object;
            var _local52:JPanel;
            var _local53:Object;
            var _local54:JPanel;
            var _local55:Object;
            var _local56:JPanel;
            var _local57:Object;
            var _local58:JPanel;
            var _local59:Object;
            var _local60:JPanel;
            var _local61:Object;
            var _local62:JPanel;
            var _local63:Object;
            var _local64:JPanel;
            var _local65:Object;
            var _local66:JPanel;
            var _local67:JPanel;
            var _local68:Object;
            var _local69:JPanel;
            var _local70:Object;
            var _local71:JPanel;
            var _local72:Object;
            var _local73:Object;
            var _local74:Object;
            var _local75:JPanel;
            var _local76:ItemBonus;
            var _local77:String;
            var _local78:Object;
            var _local79:JPanel;
            var _local80:Object;
            var _local81:Object;
            var _local82:Object;
            var _local1:Number = this.m_dataItem.buildTimeInDays();
            this.setPreferredWidth(this.originalTTWidth);
            var _local2:JPanel = this.GetSalePanelForItem();
            switch (this.m_dataItem.type){
                case "starter_pack1":
                case "starter_pack2":
                case "starter_pack3":
                    _local3 = new Object();
                    _local3.type = TooltipType.STARTER_PACK;
                    _local3.content = ZLoc.t("Items", "starter_pack_friendlyName");
                    _local3.dataItem = this.m_dataItem;
                    _local3.contentPanel = this.m_contentPanel;
                    _local4 = TooltipFactory.getInstance().createTooltip(_local3);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local4);
                    break;
                case "mystery_crate":
                    _local5 = new Object();
                    _local5.type = "mystery_crate";
                    _local5.content = ZLoc.t("Items", "mystery_crate_friendlyName");
                    _local5.dataItem = this.m_dataItem;
                    _local5.contentPanel = this.m_contentPanel;
                    _local6 = TooltipFactory.getInstance().createTooltip(_local5);
                    ASwingHelper.prepare(_local6);
                    this.setPreferredWidth(_local6.getWidth());
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local6);
                    break;
                case "residence":
                    _local7 = new Object();
                    _local7.type = TooltipType.ONE_ITEM;
                    _local7.title = ZLoc.t("Dialogs", "TT_Population");
                    _local7.firstIcon = (new EmbeddedArt.mkt_populationIcon() as DisplayObject);
                    _local8 = {
                        maxPop:(this.m_dataItem.populationMax * Global.gameSettings.getNumber("populationScale", 1)),
                        minPop:(this.m_dataItem.populationBase * Global.gameSettings.getNumber("populationScale", 1))
                    };
                    _local7.firstData = (((String(_local8.minPop) + "-") + String(_local8.maxPop)) + "   ");
                    _local9 = TooltipFactory.getInstance().createTooltip(_local7);
                    _local10 = new Object();
                    _local10.type = TooltipType.TWO_ITEMS;
                    _local10.title = ZLoc.t("Dialogs", "TT_Rent");
                    _local10.firstIcon = (new EmbeddedArt.mkt_coinIcon() as DisplayObject);
                    _local10.firstData = String(Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_COIN));
                    _local10.lastLine = CardUtil.localizeTimeLeftLanguage(this.m_dataItem.growTime);
                    _local11 = TooltipFactory.getInstance().createTooltip(_local10);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local9, _local11);
                    break;
                case "business":
                    if (this.m_dataItem.localizedName == ZLoc.t("Items", "biz_lotsite_4x4_friendlyName")){
                        _local59 = new Object();
                        _local59.type = TooltipType.EMPTY_LOT;
                        _local59.ttbgWidth = this.m_ttbg.width;
                        _local60 = TooltipFactory.getInstance().createTooltip(_local59);
                        this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local60);
                    } else {
                        if (this.m_dataItem.localizedName == ZLoc.t("Items", "supply_all_business_friendlyName")){
                            _local61 = new Object();
                            _local61.type = TooltipType.DESCRIPTION;
                            _local61.ttbgWidth = this.m_ttbg.width;
                            _local61.content = ZLoc.t("Items", "supply_all_business_content");
                            _local62 = TooltipFactory.getInstance().createTooltip(_local61);
                            this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local62);
                        } else {
                            if (this.m_dataItem.localizedName == ZLoc.t("Items", "mark_all_business_ready_friendlyName")){
                                _local63 = new Object();
                                _local63.type = TooltipType.DESCRIPTION;
                                _local63.ttbgWidth = this.m_ttbg.width;
                                _local63.content = ZLoc.t("Items", "mark_all_business_ready_content");
                                _local64 = TooltipFactory.getInstance().createTooltip(_local63);
                                this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local64);
                            } else {
                                if (this.m_dataItem.localizedName == ZLoc.t("Items", "instant_ready_crop_friendlyName")){
                                    _local65 = new Object();
                                    _local65.type = TooltipType.DESCRIPTION;
                                    _local65.ttbgWidth = this.m_ttbg.width;
                                    _local65.content = ZLoc.t("Items", "instant_ready_crop_content");
                                    _local66 = TooltipFactory.getInstance().createTooltip(_local65);
                                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local66);
                                } else {
                                    if (((!((this.m_dataItem.upgrade == null))) && (Global.player.isEligibleForBusinessUpgrades()))){
                                        _local72 = new Object();
                                        _local72.type = TooltipType.ONE_ITEM;
                                        _local72.firstIcon = (new EmbeddedArt.mkt_masteryStar() as DisplayObject);
                                        _local72.firstData = String(TextFieldUtil.formatSmallCapsString((ZLoc.t("Dialogs", "TT_Upgradeable") + " ")));
                                        _local67 = TooltipFactory.getInstance().createTooltip(_local72);
                                    };
                                    _local68 = new Object();
                                    _local68.type = TooltipType.ONE_ITEM;
                                    _local68.title = ZLoc.t("Dialogs", "TT_Earnings");
                                    _local68.firstIcon = (new EmbeddedArt.mkt_coinIcon() as DisplayObject);
                                    _local68.firstData = String(Math.ceil((Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_COIN) * this.m_dataItem.commodityReq)));
                                    _local68.lastLine = ZLoc.t("Dialogs", "TT_perPerson");
                                    _local69 = TooltipFactory.getInstance().createTooltip(_local68);
                                    _local70 = new Object();
                                    _local70.type = TooltipType.ONE_ITEM_W_LINE;
                                    _local70.title = ZLoc.t("Dialogs", "TT_SupplyReq");
                                    if (this.m_dataItem.commodityName == Commodities.GOODS_COMMODITY){
                                        _local70.firstIcon = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                                        _local70.firstData = String(this.m_dataItem.commodityReq);
                                    } else {
                                        if (this.m_dataItem.commodityName == Commodities.PREMIUM_GOODS_COMMODITY){
                                            _local70.firstIcon = (new EmbeddedArt.mkt_premiumGoodsIcon() as DisplayObject);
                                            _local70.firstData = String(this.m_dataItem.commodityReq);
                                        };
                                    };
                                    _local70.lastLine = ZLoc.t("Dialogs", "TT_perPerson");
                                    _local71 = TooltipFactory.getInstance().createTooltip(_local70);
                                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local67, _local2, _local69, _local71);
                                };
                            };
                        };
                    };
                    break;
                case "storage":
                    _local12 = new Object();
                    _local12.type = TooltipType.ONE_ITEM;
                    _local12.title = ZLoc.t("Dialogs", "TT_Storage");
                    _local12.firstIcon = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                    _local12.firstData = String(this.m_dataItem.commodityCapacity);
                    _local13 = TooltipFactory.getInstance().createTooltip(_local12);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local13);
                    break;
                case "plot":
                    break;
                case "plot_contract":
                    _local14 = new Object();
                    _local14.type = TooltipType.ONE_ITEM;
                    _local14.title = ZLoc.t("Dialogs", "TT_Makes");
                    if (Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_PREMIUM_GOODS) > 0){
                        _local14.firstIcon = (new EmbeddedArt.mkt_premiumGoodsIcon() as DisplayObject);
                        _local14.firstData = String(Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_PREMIUM_GOODS));
                    } else {
                        _local14.firstIcon = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                        _local14.firstData = String(Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_GOODS));
                    };
                    _local15 = TooltipFactory.getInstance().createTooltip(_local14);
                    _local16 = new Object();
                    _local16.type = TooltipType.ONE_LINE;
                    _local16.title = ZLoc.t("Dialogs", "TT_Harvest");
                    if (this.m_dataItem.growTime > 2.4E-5){
                        _local16.firstData = CardUtil.localizeTimeLeft(this.m_dataItem.growTime);
                    } else {
                        _local16.firstData = ZLoc.t("Dialogs", "TT_InstantGrow");
                    };
                    if (this.m_dataItem.name == "plot_lettuce"){
                        _local73 = new Object();
                        _local73.type = TooltipType.DESCRIPTION;
                        _local73.ttbgWidth = this.m_ttbg.width;
                        _local73.content = ZLoc.t("Dialogs", "TT_PotatoRules");
                        _local17 = TooltipFactory.getInstance().createTooltip(_local73);
                    };
                    _local18 = TooltipFactory.getInstance().createTooltip(_local16);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local15, _local18, _local17);
                    break;
                case "factory_contract":
                    _local19 = new Object();
                    _local19.type = TooltipType.ONE_ITEM;
                    _local19.title = ZLoc.t("Dialogs", "TT_Makes");
                    if (Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_PREMIUM_GOODS) > 0){
                        _local19.firstIcon = (new EmbeddedArt.mkt_premiumGoodsIcon() as DisplayObject);
                        _local19.firstData = ZLoc.t("Dialogs", "TT_PerWorker", {amount:Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_PREMIUM_GOODS)});
                    } else {
                        _local19.firstIcon = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                        _local19.firstData = ZLoc.t("Dialogs", "TT_PerWorker", {amount:Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_GOODS)});
                    };
                    _local20 = TooltipFactory.getInstance().createTooltip(_local19);
                    _local21 = new Object();
                    _local21.type = TooltipType.ONE_LINE;
                    _local21.title = ZLoc.t("Dialogs", "TT_BuildsIn");
                    if (this.m_dataItem.growTime > 2.4E-5){
                        _local21.firstData = CardUtil.localizeTimeLeft(this.m_dataItem.growTime);
                    } else {
                        _local21.firstData = ZLoc.t("Dialogs", "TT_InstantGrow");
                    };
                    _local22 = TooltipFactory.getInstance().createTooltip(_local21);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local20, _local22);
                    break;
                case "decoration":
                    if (this.m_dataItem.bonusPercent > 0){
                        _local74 = new Object();
                        _local74.type = TooltipType.ONE_LINE;
                        _local74.title = ZLoc.t("Dialogs", "TT_Bonus");
                        _local74.firstData = ZLoc.t("Dialogs", "TT_Payout", {amount:this.m_dataItem.bonusPercent});
                        _local75 = TooltipFactory.getInstance().createTooltip(_local74);
                        this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local75);
                        if (this.m_dataItem.bonuses.length > 0){
                            _local76 = this.m_dataItem.bonuses[0];
                            for each (_local77 in _local76.allowedTypes) {
                                _local78 = {
                                    type:"indentedDescriptor",
                                    firstData:ZLoc.t("Dialogs", ("TT_Payout_" + _local77))
                                };
                                _local79 = TooltipFactory.getInstance().createTooltip(_local78);
                                this.m_contentPanel.appendAll(_local79);
                            };
                        };
                    } else {
                        this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2);
                    };
                    break;
                case "pier":
                    break;
                case "ship":
                case "harvest_ship":
                    _local23 = new Object();
                    _local23.type = TooltipType.DESCRIPTION;
                    _local23.ttbgWidth = this.m_ttbg.width;
                    _local23.content = ZLoc.t("Dialogs", "TT_ShipRules");
                    _local24 = TooltipFactory.getInstance().createTooltip(_local23);
                    _local25 = new Object();
                    _local25.type = TooltipType.REQUIREMENT;
                    _local25.ttbgWidth = this.m_ttbg.width;
                    _local25.content = ZLoc.t("Dialogs", "TT_ShipReq");
                    _local26 = TooltipFactory.getInstance().createTooltip(_local25);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local24, _local26);
                    break;
                case "ship_contract":
                    _local14 = new Object();
                    _local14.type = TooltipType.ONE_ITEM;
                    _local14.title = ZLoc.t("Dialogs", "TT_Makes");
                    _local14.firstIcon = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                    _local14.firstData = String(Global.player.GetDooberMinimums(this.m_dataItem, Doober.DOOBER_GOODS));
                    _local15 = TooltipFactory.getInstance().createTooltip(_local14);
                    _local27 = new Object();
                    _local27.type = TooltipType.ONE_LINE;
                    _local27.title = ZLoc.t("Dialogs", "TT_RoundTrip");
                    _local27.firstData = CardUtil.localizeTimeLeft(this.m_dataItem.growTime);
                    _local28 = TooltipFactory.getInstance().createTooltip(_local27);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local15, _local28);
                    break;
                case "municipal":
                    if ((((this.m_dataItem.name == "mun_policestation")) && ((Global.player.level >= 10)))){
                        _local80 = new Object();
                        _local80.type = TooltipType.ONE_ITEM;
                        _local80.title = ZLoc.t("Dialogs", "TT_Unlocks");
                        _local80.firstIcon = (new EmbeddedArt.mkt_shieldIcon() as DisplayObject);
                        _local80.firstData = (ZLoc.t("Dialogs", "TT_copsnbandits") + " ");
                        _local29 = TooltipFactory.getInstance().createTooltip(_local80);
                    };
                    _local30 = new Object();
                    _local30.type = TooltipType.ONE_ITEM;
                    _local30.title = ZLoc.t("Dialogs", "TT_Allows");
                    _local30.firstIcon = (new EmbeddedArt.mkt_populationIcon() as DisplayObject);
                    _local30.firstData = String((this.m_dataItem.populationCapYield * Global.gameSettings.getNumber("populationScale", 1)));
                    _local31 = TooltipFactory.getInstance().createTooltip(_local30);
                    _local32 = new Object();
                    _local32.type = TooltipType.DESCRIPTION;
                    _local32.ttbgWidth = this.m_ttbg.width;
                    _local32.content = ZLoc.t("Dialogs", "TT_MuniRules");
                    _local33 = TooltipFactory.getInstance().createTooltip(_local32);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local29, _local31, _local33);
                    break;
                case "expansion":
                    this.m_contentPanel.append(this.m_centerHrPanel);
                    _local34 = {
                        type:"requirement",
                        content:ZLoc.t("Dialogs", "TT_Requires")
                    };
                    this.m_contentPanel.append(TooltipFactory.getInstance().createTooltip(_local34));
                    _local35 = ExpansionManager.instance.getNextExpansionPermitRequirement();
                    _local36 = Global.player.inventory.getItemCountByName(Item.PERMIT_ITEM);
                    _local37 = ExpansionManager.instance.getNextExpansionPopulationRequirement();
                    _local38 = Global.world.citySim.getPopulation();
                    if (_local35 > 0){
                        _local81 = {
                            type:"checkmarkwLine",
                            firstData:ZLoc.t("Dialogs", "TT_ExpansionPermitsReq", {permits:Math.max(0, (_local35 - _local36))}),
                            isComplete:(_local36 >= _local35)
                        };
                        this.m_contentPanel.append(TooltipFactory.getInstance().createTooltip(_local81));
                    };
                    if (_local37 > 0){
                        _local82 = {
                            type:"checkmarkwLine",
                            firstColor:EmbeddedArt.greenTextColor,
                            firstData:ZLoc.t("Dialogs", "TT_ExpansionPopulationReq", {population:(_local37 * Global.gameSettings.getNumber("populationScale", 1))}),
                            isComplete:(_local38 >= _local37)
                        };
                        this.m_contentPanel.append(TooltipFactory.getInstance().createTooltip(_local82));
                    };
                    _local39 = new Object();
                    _local39.type = TooltipType.DESCRIPTION;
                    _local39.ttbgWidth = this.m_ttbg.width;
                    _local39.content = ZLoc.t("Dialogs", "TT_ExpansionRules");
                    this.m_contentPanel.append(TooltipFactory.getInstance().createTooltip(_local39));
                    break;
                case "energy":
                    _local40 = new Object();
                    _local40.type = TooltipType.ONE_ITEM;
                    _local40.title = ZLoc.t("Dialogs", "TT_Energy");
                    _local40.firstIcon = (new EmbeddedArt.mkt_energyIcon() as DisplayObject);
                    _local40.firstData = String(this.m_dataItem.energyRewards);
                    _local41 = TooltipFactory.getInstance().createTooltip(_local40);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local41);
                    break;
                case "theme_collection":
                    _local42 = !(Global.world.isThemeCollectionEnabled(this.m_dataItem));
                    _local43 = new Object();
                    _local43.type = TooltipType.DESCRIPTION;
                    _local43.ttbgWidth = this.m_ttbg.width;
                    _local43.content = ZLoc.t("Dialogs", ((("TT_ThemeCollection_" + this.m_dataItem.name) + "_") + (_local42) ? "on" : "off"));
                    _local44 = TooltipFactory.getInstance().createTooltip(_local43);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local44);
                    break;
                case "landmark":
                    _local45 = new Object();
                    _local45.type = TooltipType.ONE_ITEM;
                    _local45.title = ZLoc.t("Dialogs", "TT_Allows");
                    _local45.firstIcon = (new EmbeddedArt.mkt_populationIcon() as DisplayObject);
                    _local45.firstData = String((this.m_dataItem.populationCapYield * Global.gameSettings.getNumber("populationScale", 1)));
                    _local46 = TooltipFactory.getInstance().createTooltip(_local45);
                    _local47 = new Object();
                    _local47.type = TooltipType.DESCRIPTION;
                    _local47.ttbgWidth = this.m_ttbg.width;
                    _local47.content = ZLoc.t("Dialogs", "TT_MuniRules");
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local2, _local46);
                    break;
                case "train":
                    if (this.m_dataItem.goods > 0){
                        _local48 = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                        _local49 = (new EmbeddedArt.mkt_coinIcon() as DisplayObject);
                        _local50 = this.m_dataItem.goods;
                    } else {
                        _local49 = (new EmbeddedArt.mkt_goodsIcon() as DisplayObject);
                        _local48 = (new EmbeddedArt.mkt_coinIcon() as DisplayObject);
                        _local50 = this.m_dataItem.cost;
                    };
                    _local51 = {
                        type:"oneItem",
                        title:ZLoc.t("Dialogs", "TT_Costs"),
                        firstIcon:_local48,
                        firstData:_local50
                    };
                    _local52 = TooltipFactory.getInstance().createTooltip(_local51);
                    _local53 = {
                        type:"oneItem",
                        title:ZLoc.t("Dialogs", "TT_Earns"),
                        firstIcon:_local49,
                        firstData:Global.gameSettings.getTieredInt(this.m_dataItem.trainPayout, this.m_dataItem.workers.amount)
                    };
                    _local54 = TooltipFactory.getInstance().createTooltip(_local53);
                    _local55 = {
                        type:"oneLine",
                        title:ZLoc.t("Dialogs", "TT_StopsAvailable"),
                        firstData:(this.m_dataItem.workers) ? this.m_dataItem.workers.amount : 0
                    };
                    _local56 = TooltipFactory.getInstance().createTooltip(_local55);
                    _local57 = {
                        type:"oneLine",
                        title:ZLoc.t("Dialogs", "TT_RoundTrip"),
                        firstData:CardUtil.localizeTimeLeft((this.m_dataItem.trainTripTime / 86400))
                    };
                    _local58 = TooltipFactory.getInstance().createTooltip(_local57);
                    this.m_contentPanel.appendAll(this.m_centerHrPanel, _local52, _local54, _local56, _local58);
                    break;
            };
        }

    }
}//package Display.MarketUI 
